<?php
/**
 *
 *
 */
class Yz_Property_Timestamp
    extends Yz_Property_Scalar
{

    /** Test if a value is a valid number
     *  @param mixed value
     *  @return int>=0|null
     *  @throw TypeError
     *  @throw ValueError
     */
    public function testValue($value)
    {
        if (null === $value)
            return $this->nullOrError();
        $value = Yz_Int::test($value);
        if ($value < 0)
            throw ValueError::_new_();
        return $value;
    }


    /** Select a default value for an item, based on the property name
     *  @param string $propName
     *  @param Yz_Item_Interface $item
     *  @return default value
     */
    public function selectValue($propName, Yz_Item_Interface $item)
    {
        return (int)YZ_TIME;
        //if ($this->allowNull())
        //    return null;
    }

}
